<%= form_tag update_multiple_permissions_path do %>
  <%= hidden_field_tag '_method', 'put' %>
  <table>
    <tr>
      <th></th>
      <th></th>
      <th class="permission_column"><%= t :create_permission %></th>
      <th class="permission_column"><%= t :read_permission %></th>
      <th class="permission_column"><%= t :update_permission %></th>
      <th class="permission_column"><%= t :delete_permission %></th>
    </tr>
    <% reset_cycle -%>
    <% @folder.permissions.each do |permission| -%>
    <%= fields_for "permissions[]", permission do |f| %>
    <tr class="<%= cycle('even','odd') %>">
      <% if permission.group.admins_group? -%>
        <td><%= image_tag('group_grey.png') %></td>
        <td class="disabled"><%= permission.group.name %></td>
        <td class="permission_column"><input type="checkbox" checked="checked" disabled="disabled" /></td>
        <td class="permission_column"><input type="checkbox" checked="checked" disabled="disabled" /></td>
        <td class="permission_column"><input type="checkbox" checked="checked" disabled="disabled" /></td>
        <td class="permission_column"><input type="checkbox" checked="checked" disabled="disabled" /></td>
      <% else -%>
        <td><%= image_tag('group.png') %></td>
        <td><%= permission.group.name %></td>
        <td class="permission_column"><%= f.check_box :can_create %></td>
        <td class="permission_column"><%= f.check_box :can_read %></td>
        <td class="permission_column"><%= f.check_box :can_update %></td>
        <td class="permission_column"><%= f.check_box :can_delete %></td>
      <% end -%>
    </tr>
    <% end -%>
    <% end -%>
  </table>
  <p class="permissions_button">
    <%= submit_tag t(:save) %>
    <%= check_box_tag :recursive, true %> <%= t :apply_changes_to_subfolders %>
    &nbsp; &mdash; &nbsp;
    <%= link_to t(:back), '#', :class => 'back_link' %>
  </p>
<% end -%>
